@extends('admin.layouts.index')
@section('title', '帮助文章列表')

@section('content')

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <div class="card-title">文章列表</div>
                @if(Auth::user()->authority == 3)
                <a href="{{ url('/admin/articles/app_articles_add') }}" class="btn btn-primary btn-xs pull-right" style="margin-top: -30px;"><i class="iconfont icon-weibiaoti37" style="font-size: 12px;margin-right: 5px;"></i>添加文章</a>
                @endif
            </div>
            <div class="card-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th scope="col">标题</th>
                            @if(Auth::user()->authority == 3)
                            <th scope="col">类型</th>
                            <th scope="col">状态</th>
                            @endif
                            <th scope="col">创建时间</th>
                            <th scope="col">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse($articles as $article)
                        <tr>
                            <td>{{ mb_substr($article->title, 0, 20, 'utf-8') }}</td>

                            @if(Auth::user()->authority == 3)
                            @if($article->type == 1)
                            <td>Banner</td>
                            @elseif($article->type == 2)
                            <td>系统文章</td>
                            @elseif($article->type == 3)
                            <td>帮助</td>
                            @else
                            <td>文章</td>
                            @endif

                            @if($article->disable == 1)
                            <td class="text-success">可用</td>
                            @else
                            <td class="text-danger">已禁用</td>
                            @endif
                            @endif

                            <td>{{ $article->created_at }}</td>
                            <td>
                                <a href="{{ url('admin/links_lists/app_articles_detial',['id'=>$article->id]) }}">查看详情</a>
                                @if(Auth::user()->authority == 3) ｜ <a href="{{ url('admin/links_lists/app_articles_update',['id'=>$article->id]) }}">更新文章</a> 
                                @endif
                            </td>
                        </tr>
                        @empty
                        <tr>
                            <td>当前暂无文章！</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

@endsection
